package controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.Book_Deal;

@WebServlet("/ClassRemove")
public class ClassRemove extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private Book_Deal deal = new Book_Deal();
	
    public ClassRemove() {
        super();
    }

	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		req.setCharacterEncoding("utf-8");
		res.setCharacterEncoding("utf-8");
		
		String receive_id = req.getParameter("receive_id");
		boolean falg = deal.remove_book_receive(receive_id);
		
		if(falg) {
			res.sendRedirect("/TeachingTest/main?page=class-put&target=4");
		}else {
			res.sendRedirect("/TeachingTest/main?page=class-put&target=4");
		}
	}

	protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
		doGet(req, res);
	}

}
